package com.b510.test;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.svo.util.MemcachedUtils;

public class MemCacheController {
    /**
     * 查找memcache中的key
     * @param key
     * @return
     */
    @RequestMapping(value = "/findSessionByKey", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String findByKey(@RequestParam String key){
    	System.out.println("MemCacheController.findByKey param:key="+key);
        if(StringUtils.isEmpty(key)){
            return "key must not be empty or null!";
        }
        return (String)MemcachedUtils.get(key);
    }
    
}